package com.seven.good.service.impl;

import com.seven.good.dao.OrdersMapper;
import com.seven.good.exception.ServiceException;
import com.seven.good.pojo.Orders;
import com.seven.good.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrdersServiceImpl implements OrdersService {

    @Autowired
    OrdersMapper ordersMapper;

    @Override
    public int isHaveDepository(Integer uid, Integer gid) {

        try {
            return ordersMapper.isHaveDepository(uid,gid);
        } catch (Exception e) {
            return 0;
        }
    }

    @Override
    public int isPaySuccessful(Integer gid) {
        try {
            return ordersMapper.isPaySuccessful(gid);
        } catch (Exception e) {
            return 0;
        }
    }

    @Override
    public Orders getIsRendBond(Integer gid, Integer uid) {
        try {
            return ordersMapper.selectIsRendBond(gid,uid);
        } catch (Exception e) {
            e.printStackTrace();
            throw new ServiceException("数据库查询异常");
        }
    }
}
